/**
 * 
 */
package lt.vin.exaatto.client.ui;

import lt.vin.exaatto.client.service.RpcService;
import lt.vin.exaatto.client.service.RpcServiceAsync;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.gdata.client.contacts.ContactsService;

/**
 * @author Vincentas
 *
 */
public class Stat {

	private static HandlerManager handlerManager;
	
	private static RpcServiceAsync rpcService;
	
	private static ContactsService contactsService;
	
	private static String user;
	
	public synchronized static HandlerManager getHandlerManager() {
		if (handlerManager == null) {
			handlerManager = new HandlerManager(null);
		}
		
		return handlerManager;
	}
	
	public synchronized static RpcServiceAsync getRpcService() {
		if (rpcService == null) {
			rpcService = GWT.create(RpcService.class);
		}
		
		return rpcService;
	}
	
	public synchronized static ContactsService getContactsService() {
		if (contactsService == null) {
			contactsService = ContactsService.newInstance("Exa-Atto");
		}
		
		return contactsService;
	}

	/**
	 * @return the user
	 */
	public static String getUser() {
		return user;
	}

	/**
	 * @param user the user to set
	 */
	public static void setUser(String user) {
		Stat.user = user;
	}
	
	
}
